home *** CD-ROM | disk | FTP | other *** search
- Path: news.rain.org!usenet
- From: "Guus Leeuw jr." <guusl@eiffel.com>
- Newsgroups: comp.lang.c++
- Subject: Re: Getting the system time and date
- Date: Mon, 22 Jan 1996 14:39:27 -0800
- Organization: ISE Inc. http://www.eiffel.com
- Message-ID: <3104121E.41FC143C@eiffel.com>
- References: <tate.1.002C7F92@netwest.com> <4e0dm2$pv4@hasle.sn.no>
- NNTP-Posting-Host: @outback.eiffel.com
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.0b3 (X11; I; Linux 1.2.8 i586)
-
- Lars-Inge Tonnessen wrote:
- >
- > tate@netwest.com (Tate Griffin) wrote:
- >
- > >How do I get the current time and date from a PC using C++?
- >
- > You can use a lib that is called "time.h". Your compiler should
- > contain it, as it's standard ANSI C.
- >
- > // Example by Lars-Inge Tonnessen 1996
- >
- > #include <time.h>
- > .
- > .
- > .
- >
- > void main(void)
- > {
- >
- > tm Times;
- > cout <<asctime(&Times);
- >
- > }
- >
- > When you run the application, it should return:
- >
- > Sun Jan 21 21:25:16 1996
-
- On my machine (Pentium 120 Linux) it returned
-
- Mon Jan 22 14:35:34 1996
-
- How could that be ;-)
-
- >
- > Take a look at the "time.h" file. It contains allmost everything that
- > has to do with the time and date.
- >
- > Lars-Inge Tonnessen
- > larsit@sn.no
-
- Guus Leeuw jr.
-